﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DomeLou.aspx.cs" Inherits="PropertyAppraisal.DoemsKanCha.DomeLou" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../jquery-easyui-1.3.5/themes/default/easyui.css" rel="stylesheet" />
    <link type="/text/css" href="../jquery-easyui-1.3.5/themes/icon.css" rel="stylesheet" />
    <link href="../jquery-easyui-1.3.5/demo/demo.css" rel="stylesheet" />
    <script type="text/javascript" src="../jquery-easyui-1.3.5/jquery-1.7.2-min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.3.5/easyloader.js"></script>


    <script type="text/javascript" src="../easyui/jquery.params.js"></script>
</head>
<body>
    <div class="demo-info">
        <div class="demo-tip icon-tip"></div>
        <%--<div>Fill the form and submit it.</div>--%>
    </div>
    <div style="margin: 0;"></div>
    <form id="form1" runat="server">
        <div class="easyui-panel" fit="true" style="border: none;">
            <iframe width="0" height="0" src="../SessionKeeper.aspx"></iframe>
            <div style="margin-left: 30px;" id="ff">
                <table>
                    <tr>
                        <td>所在楼号：</td>
                        <td style="padding-left: 50px;">
                            <input class="easyui-validatebox" missingmessage="必填" type="text" id="louhao" data-options="required:true" style="width: 800px;" placeholder="请输入所在楼号" maxlength="40" />
                        </td>
                    </tr>
                    <tr>
                        <td>地图：</td>
                        <td style="padding-left: 50px;">
                            <div style="width: 800px; height: 300px; border: 1px solid blue;" id="map">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>定位坐标：</td>
                        <td style="padding-left: 50px;">
                            <input class="easyui-validatebox" missingmessage="必填" type="text" id="zuobiao" style="width: 800px;" readonly="true" maxlength="40" />
                        </td>
                    </tr>
                    <tr>
                        <td>定位地址：</td>
                        <td style="padding-left: 50px;">
                            <input class="easyui-validatebox" missingmessage="必填" type="text" id="addr" style="width: 800px;" maxlength="40" />
                        </td>
                    </tr>
                    <tr>
                        <td>房屋结构：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select1" data-options="editable:false">
                                <%=housjBD() %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>建筑类型：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select2" data-options="editable:false">
                                <%=typeBD() %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>外立面装饰：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select3" data-options="editable:false">
                                <%=wzBD() %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>公共部位装饰：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select4" data-options="editable:false">
                                <%=gzBD() %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>电梯：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select5" data-options="editable:false">
                                <%=dianBD() %>
                            </select><br />
                            <input type="number" min="1" class="easyui-textbox" id="dnum" />
                        </td>
                    </tr>
                    <tr>
                        <td>供气：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select6" data-options="editable:false">
                                <%=gqBD() %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>供水：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select7" data-options="editable:false">
                                <%=gsBD() %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>供暖：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select8" data-options="editable:false">
                                <%=gnBD() %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>门禁系统：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select9" data-options="editable:false">
                                <%=doorBD() %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>其他:</td>
                        <td style="padding-left: 50px;">
                            <textarea id="message" style="height: 60px; width: 800px;" placeholder="说点什么...最少输入10个字" maxlength="400"></textarea>
                        </td>
                    </tr>
                </table>
            </div>
            <div style="text-align: center; padding: 5px">
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a>
            </div>
        </div>
    </form>


    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=4OFP8rc1v0r74nUe45AtjtiAv8KnVfZI"></script>
    <script>
        //提交
        function submitForm() {
            var louhao = $("#louhao").val();
            var zuo = $("#zuobiao").val();
            var address = $("#addr").val();
            var housje = $("#select1").val();
            var jtype = $("#select2").val();
            var wshi = $("#select3").val();
            var gshi = $("#select4").val();
            var dian = $("#select5").val();
            var dnum = $("#dnum").val();

            var gqi = $("#select6").val();
            var gshui = $("#select7").val();
            var gnuam = $("#select8").val();
            var door = $("#select9").val();
            var qita = $("#message").val();
            dnum = 0;
            var prenum = $.query.get("id");//项目号;

            if ( $.isEmptyObject(louhao) || $.isEmptyObject(zuo) || $.isEmptyObject(address)
                || $.isEmptyObject(housje) || $.isEmptyObject(jtype) || $.isEmptyObject(wshi) || $.isEmptyObject(gshi) ||
                $.isEmptyObject(dian) || $.isEmptyObject(gqi) || $.isEmptyObject(gshui) 
                || $.isEmptyObject(door) || $.isEmptyObject(qita)) {
                $.messager.alert('温馨提示：', '不可为空,请您输入信息');

            }
            else {
                $.ajax({
                    type: "post", //要用post方式                 
                    url: "DomeLou.aspx/submins",//方法所在页面和方法名
                    data: "{'ProjectNumber':'" + prenum + "','Location_East':'" + louhao + "','Location_West':'" + zuo + "','Location_North':'" + address + "','Location_South':'" + housje + "','Location_Position':'" + jtype + "','Location_Traffic':'" + wshi + "','Location_Convenient':'" + gshi + "','Location_Humanity':'" + dian + "','Location_Quality':'" + dnum + "','Location_Community':'" + gqi + "','Location_Mature':'" + gshui + "','gongnuan':'" + gnuam + "','Location_Facilities':'" + door + "','Location_Degree':'" + qita + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        var json = eval("(" + data.d + ")");

                        if (json == 1) {
                            $.messager.alert("提示信息", "提交成功");
                        }
                        else
                            $.messager.alert("提示信息", "提交失败");
                    }
                });
            }
        }

        //加载地图获取坐标  与  位置信息
        $(function () {
$(function () {
                var state = $.query.get("state");
                var P_ReportNumber = $.query.get("id");//项目号
                if (state != "已提交/待勘察") {
                    $("select").attr("disabled", true);
                    $("input").attr("disabled", true);
                    $("textarea").attr("disabled", true);
                    $("a").attr("disabled", true);
                }
                $.ajax({
                    type: "post", //要用post方式                 
                    url: "DomeQuwei.aspx/BackData",//方法所在页面和方法名
                    data: "{'pnum':'" + P_ReportNumber + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        var json = eval("(" + data.d + ")");
                        $("#louhao").val(json[0].floor_Number);
                        $("#zuobiao").val(json[0].floor_Landmark);
                        $("#addr").val(json[0].floor_Address);
                        $("#select1").val(json[0].floor_HouseStructure);
                        $("#select2").val(json[0].floor_BuildType);
                        $("#select3").val(json[0].floor_Public);
                        $("#select4").val(json[0].floor_Facade);
                        $("#select5").val(json[0].floor_Lift);
                        $("#dnum").val(json[0].floor_LiftNum);
                        $("#select6").val(json[0].floor_Gas);
                        $("#select7").val(json[0].floor_Water);
                        $("#select8").val(json[0].floor_Warm);
                        $("#select9").val(json[0].floor_Door);
                        $("#message").val(json[0].floor_Explain);
                    }
                })
            })//开始查询切换下拉框与文本框           22001 22002   
            $("#select5").combobox({
                onChange: function (n, o) {
                    var value = $('#select5').combobox("getValue");
                    if (value == 22001) {
                        $("#dnum").hide();
                    }
                    else {
                        $("#dnum").show();
                    }
                }
            });
            //结束查询切换下拉框与文本框            // 百度地图API功能
            var map = new BMap.Map("map");
            var point = "";
            // 创建Map实例
            if ($("#zuobiao").val() == "" || $("#zuobiao").val() == null) {
                 point = new BMap.Point(116.404, 39.915);
            }
            else {
                var list= $("#zuobiao").val().split(',');
                 point = new BMap.Point(list[0],list[1]);
            }            //中心坐标   15画质
            map.centerAndZoom(point, 15);
            //开启滚轮缩放地图
            map.enableScrollWheelZoom();
            //默认添加一个标注  坐标为(116.404, 39.915);
            var marker = new BMap.Marker(point);
            map.addOverlay(marker);
            //click--点击事件获取经纬度
            map.addEventListener("click", function (e) {
                //清除标注
                map.clearOverlays(marker);
                //创建Map实例
                var point = new BMap.Point(e.point.lng, e.point.lat);
                //添加标注点
                var marker = new BMap.Marker(point);
                map.addOverlay(marker);
                //  $("#Floor_Landmark").textbox("setValue", e.point.lng + "," + e.point.lat)
                $("#zuobiao").val(e.point.lng + "," + e.point.lat);
                // 创建地理编码服务实例 
                var myGeo = new BMap.Geocoder();
                // 根据坐标得到地址描述 
                myGeo.getLocation(new BMap.Point(e.point.lng, e.point.lat), function (result) {
                    if (result) {
                        $("#addr").val(result.address);
                    }
                })




            })
        })
    </script>
</body>
</html>
